﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Licenta1.Expressions
{
    [Serializable]
    class ObjectMathExpressionID : Expression
    {
        public IdentifierExpression val;

        public ObjectMathExpressionID(Context context, Expression expr)
            : base(context)
        {
            val = (IdentifierExpression)expr;
        }

        public override object Value
        {   
            get
            {
        //        Console.WriteLine("Called value: " + val.Name + "\n Varibles contains: " + context.variables.Count);
        //        Console.WriteLine("In identifier value = " + context.variables[val.Name]);
                if (context.variables.ContainsKey(val.Name))
                    return context.variables[val.Name];
                else return 0;
            }
        }
    }
}
